import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { TargetAwardInfo } from "../model/TargetAwardInfo";
import { StringHelper } from "../../../com/gengine/utils/StringHelper";
type int = number;
//class TargetConfig
    
    export  class TargetConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            if (TargetConfig._instance != null) 
            {
                throw new Error("TargetConfig 单例");
            }
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_comprehension_target_reward.json");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            var loc4=null;
            var loc5=0;
            var loc6=0;
            var loc7=arg1;
            for(loc4 of loc7) 
            {
                loc1 = new TargetAwardInfo();
                loc1.bindCoin = loc4.bindCoin;
                loc1.experience = loc4.experience;
                loc1.day = loc4.day;
                loc2 = StringHelper.getString(loc4.itemList);
                loc3 = loc2.split("#");
                loc5 = 0;
                while (loc5 < loc3.length) 
                {
                    if (loc3[loc5] == "#" || loc3[loc5] == "") 
                    {
                        loc3.splice(loc5, 1);
                    }
                    ++loc5;
                }
                loc1.itemList = loc3;
                this._map[loc1.day] = loc1;
            }
            return;
        }

        public getTargetAwardByDay(arg1: int): TargetAwardInfo
        {
            return this._map[arg1];
        }

        public static get instance(): TargetConfig
        {
            if (TargetConfig._instance == null) 
            {
                TargetConfig._instance = new TargetConfig();
            }
            return TargetConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: TargetConfig;
    }
